<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../../org/angular.min.js"></script>
</head>

<body ng-app="app" ng-controller="ctrl">
    <script>
        var m = angular.module('app', []);
        m.controller('ctrl', ['$scope', function($scope) {
            //对象扩展
            var obj = {
                name: 'zyx'
            };
            angular.extend(obj, {
                url: 'zyx.com'
            })
            console.log(obj); //{name:'zyx',url:'zyx.com'}

            //----遍历数组
            var data = [{
                name: '北京',
                url: 'beijing.com'
            }, {
                name: '上海',
                url: 'shanghai.com'
            }, {
                name: '深圳',
                url: 'shenzhen.com'
            }, {
                name: '四川',
                url: 'sichuan.com'
            }]
            angular.forEach(data, function(v, k) {
                console.log(v, k);
            })
            //----遍历对象
            var obj = {
                name: 'laozhou',
                age: 18
            }
            angular.forEach(obj, function(v, k) {
                console.log(v, k);
            })
        }])
    </script>
</body>

</html>
